package cn.iocoder.springboot.lab72;

import java.io.File;
import java.sql.*;
import java.util.ResourceBundle;

public class CountTableRows {

    static ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle("db_config");

    public static Connection getConnect() throws SQLException {
        String username = RESOURCE_BUNDLE.getString("username");
        String password = RESOURCE_BUNDLE.getString("password");
        String url = RESOURCE_BUNDLE.getString("url");
        return DriverManager.getConnection(url, username, password);
    }

    public static void main(String[] args) throws SQLException {
        Connection connect = getConnect();
        String dbname = RESOURCE_BUNDLE.getString("dbname");
        String sql = "select count(*) as data_total from loans_interface_log_20221116";
        Statement statement = connect.createStatement();
        ResultSet resultSet = statement.executeQuery(sql);
        while (resultSet.next()) {
            System.out.println(resultSet.getString(1) + ":" + resultSet.getLong(2));
        }
    }
}
